﻿using System;
using Grundy.Common;
using Grundy.Entity;
using Grundy.Message;

namespace Grundy.Licensing.Server
{
    public class CountedFloatingLicensesExhaustedException : Exception
    {
        private readonly FeatureIdentificationKey _fik;
        private readonly CountedFloatingLicense _license;
        private readonly long _used;

        public CountedFloatingLicensesExhaustedException(FeatureIdentificationKey fik, CountedFloatingLicense license, long used)
        {
            _fik = fik;
            _license = license;
            _used = used;
        }

        public override string Message
        {
            get { return "Licenses for {0} have been exhausted. Limit type: {1}, Limit: {2}, Used: {3}.".FormatWith(_fik, _license.LimitType, _license.Limit, _used); }
        }
    }
}